<?php 




if ((isset($_GET['id'])) && ($_GET['id'] != "")) {
  $deleteSQL = sprintf("DELETE FROM bannerplug WHERE id=%s",
                       GetSQLValueString($_GET['id'], "int"));
					   
  mysql_select_db($database_konek, $konek);
  $Result1 = mysql_query($deleteSQL, $konek) or die(mysql_error());
  
  $deleteSQL2 = sprintf("DELETE FROM bannerplug_data WHERE id_module=%s",
                       GetSQLValueString($_GET['id'], "int"));
					   
  mysql_select_db($database_konek, $konek);
  $Result1 = mysql_query($deleteSQL2, $konek) or die(mysql_error());
  
  function rrmdir($dir) { 
   if (is_dir($dir)) { 
     $objects = scandir($dir); 
     foreach ($objects as $object) { 
       if ($object != "." && $object != "..") { 
         if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object); 
       } 
     } 
     reset($objects); 
     rmdir($dir); 
   } 
 } 
  
  
  if (file_exists('../g-konten/fm/slide/'.$_GET['id'].'/'))
  rrmdir('../g-konten/fm/slide/'.$_GET['id']);

  $deleteGoTo = "add_module.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
   ?>
	
	 <script language="javascript">
  	<!--
     	    alert('Delete Success')
			window.location = "home.php?page=pluginview&p=<?php echo $_GET['p'] ?>&root=add_module.php";
			
   	--></script>
	<?php
}

?>
